/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86155
 * date: 2024-03-24
 * Time: 14:59
 *
 * @author 继承进阶
 */

class Animal{
    public String name;
    public int age;//可以被继承但是不能被访问
    static {
        System.out.println("Animal stastic");
    }
    {
        System.out.println("Animal ");
    }
    public Animal(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("public Animal(String name,int age)");
    }
    public void eat(){
        System.out.println(name + "吃饭");
    }
}
class Dog1 extends Animal{
    //狗的属性
    public String sha;
    public String name = "hell";
    /*public Dog1(String name,int age,String sha){
        super(name,age);//必须第一行
        this.sha = "sha";
    }*/
    static {
        System.out.println("dog stastic");
    }
    {
        System.out.println("dog");
    }
    public Dog1(){
        super("name",10);
        System.out.println("public Dog1()");
    }
    public void house(){
        System.out.println(name +sha+ "正在看家护院");
    }
}
class Cat1 extends Animal{
    public String caatch;
    public Cat1(String name,int age,String caatch){
        super(name,age);
        this.caatch = "抓";
    }
    public void catch1(){
        System.out.println(name +caatch+"抓老鼠");
    }
}
public class Test3 {
    public static void main(String[] args) {
        Dog1 dog = new Dog1();
        //dog.house();
       // Cat1 cat = new Cat1("ame",10,"caatch");
        //cat.catch1();
    }
}
